/*
Ashley Victoria Whillans	
Proposal title: The Barriers of Buying Happier Time


HYPOTHESES

Stated-Hyp1: "We predict that people who are asked to think about the value of their time will report that outsourcing is more expensive compared to people in the control condition" (p. 3)

	Test-Hyp1: Percieved cost of outsourcing will be higher in treatment vs. control group.

Stated-Hyp2: "we will also assess whether respondents who are paid by the hour, and who are assigned to think about the value of their time, will report the highest outsourcing estimates" (p. 3)

	Test-Hyp2: The treatment effect will be larger for respondents who are paid hourly vs. those not paid hourly.

Stated-Hyp3: "people with children living at home might be more affected by our experimental manipulation" [moderator]

	Test-Hyp3: The treatment effect will be larger for respondents living with kids vs. not living with kids.


Stated-Hyp4: "It is possible that people who value time might be exceptionally sensitive to the experimental manipulation and therefore make higher outsourcing estimates" [moderator]

	Test-Hyp4: The treatment effect will be larger for respondents who value time more vs. those who value money more.
	
Stated-Hyp5: "... research suggests happy people make very different decisions than less happy people." (p. 4)

	Test-Hyp5: The treatment effect will vary by respondent happiness. 

********************************************************************************
NOTES
- The proposal alluded to a plan for examining moderation effects. We have added 
hypotheses about all potential moderators that were mentioned in the proposal. 

*/

clear all
use "Whillans626.dta", clear

********************************************************************************

* INDICATORS OF EXPERIMENTAL MANIPULATIONS

	tab XTESS180
	recode XTESS180 (1=1) (2=0), gen(treated)
	
	
* OUTCOME MEASURES
	tab Q5

	/*
$0		1
$1 - $20	2
$21-$40	3
$41-$60	4
$61-$80	5
$81-$100	6
$101-$200	7
$201-$300	8
$301-$400	9
$401-$500	10
$501-$600	11
$601-$700	12
$701-$800	13
$801-$900	14
$901-$1000	15
$1,001-$2,500	16
More than $2500	17
*/

	clonevar cost=Q5 
	replace cost=. if cost==-1
 	
* MODERATORS

* baseline happiness (2 measures)

	* Taking all things together, how happy would you say you are?
	tab Q1
	replace Q1=. if Q1==-1
	
	* ladder
	tab Q2
	replace Q2=. if Q2==-1
	
	* baseline happiness scale
	gen happy=Q1+Q2
	tab happy
	
* children at home	
	tab Q13
	recode Q13 (1 8=0) (2/7=1) (-1=.), gen(kidsathome)
	tab kidsathome
	
* values time over money

	foreach var in Q11a Q11b {
		recode `var' (1=1) (2=0) (-1=.)
		tab `var'
	}
		
	gen valuestime = Q11a 
	replace valuestime= Q11b if Q11a==.
	tab valuestime
	
* paid by the hour

	tab Q12
	
	replace Q12=. if Q12==-1 // recode missing
	
	tab Q12_Other // examine other category; 134 cases
		* recode "other" as not hourly
			/*flagging cases that have commission / 
			self-employment/salary/monthly/per job / stipend */
	gen nothourly = 1 if regexm(Q12_Other, "commission")
	replace nothourly = 1 if regexm(Q12_Other, "COMMISSION")
	replace nothourly = 1 if regexm(Q12_Other, "commision")
	replace nothourly = 1 if regexm(Q12_Other, "commisions")
	replace nothourly = 1 if regexm(Q12_Other, "comissions")
	replace nothourly = 1 if regexm(Q12_Other, "Commision")
	replace nothourly = 1 if regexm(Q12_Other, "Commission")
	replace nothourly = 1 if regexm(Q12_Other, "Comission")
	replace nothourly = 1 if regexm(Q12_Other, "comm")
	replace nothourly = 1 if regexm(Q12_Other, "percentage")
	replace nothourly = 1 if regexm(Q12_Other, "percent")
	replace nothourly = 1 if regexm(Q12_Other, "self employed")
	replace nothourly = 1 if regexm(Q12_Other, "self-employed")
	replace nothourly = 1 if regexm(Q12_Other, "Self-employed")
	replace nothourly = 1 if regexm(Q12_Other, "Self employed")
	replace nothourly = 1 if regexm(Q12_Other, "Self")
	replace nothourly = 1 if regexm(Q12_Other, "self")
	replace nothourly = 1 if regexm(Q12_Other, "owner")
	replace nothourly = 1 if regexm(Q12_Other, "Salary")
	replace nothourly = 1 if regexm(Q12_Other, "salary")
	replace nothourly = 1 if regexm(Q12_Other, "stipend")
	replace nothourly = 1 if regexm(Q12_Other, "mile")
	replace nothourly = 1 if regexm(Q12_Other, "day")
	replace nothourly = 1 if regexm(Q12_Other, "session")
	replace nothourly = 1 if regexm(Q12_Other, "profits")
	replace nothourly = 1 if regexm(Q12_Other, "farm")
	replace nothourly = 1 if regexm(Q12_Other, "monthly")
	replace nothourly = 1 if regexm(Q12_Other, "year")
	replace nothourly = 1 if regexm(Q12_Other, "clients")
	replace nothourly = 1 if regexm(Q12_Other, "project")
	replace nothourly = 1 if regexm(Q12_Other, "per job")
	
	tab Q12_Other if nothourly!=1
	// majorty not hourly; per golden rule, treating other category as not hourly.
	
	recode Q12 (1=1) (2/3=0), gen(paid_hourly)
	tab paid_hourly
	
********************************************************************************

* ANALYSIS
	

*	Test-Hyp1: Percieved cost of outsourcing will be higher in treatment vs. control group.

	reg cost i.treated
	// reject. p=0.060
	tess 1.treated +, init(Whillans626)
	
*	Test-Hyp2: The treatment effect will be larger among respondents who are paid hourly vs. those not paid hourly.

	reg cost i.treated##i.paid_hourly
	// reject. 0.326
	tess 1.treated#1.paid_hourly +

*	Test-Hyp3: The treatment effect will be larger among people living with kids vs. not living with kids.

	reg cost i.treated##i.kidsathome
	// reject. 0.708
	tess 1.treated#1.kidsathome +
	
* 	Test-Hyp4: The treatment effect will be larger for respondents who value time more vs. those who value money more.

	reg cost i.treated##i.valuestime
	// reject. 0.787
	tess 1.treated#1.valuestime +
	
	
*	Test-Hyp5: The treatment effect will vary by respondent happiness. 
	reg cost i.treated##c.happy
	// do not reject. 0.031
	tess 1.treated#c.happy
